<?php // para conversion a otros tipos de datos
if (array_key_exists('nolayout', $this->params['url'])){
    echo $content_for_layout;
    die;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php echo $html->charset(); ?>
<title>
<?php echo $title_for_layout; ?>
</title>
<?php
    echo $html->css('report_html');
    echo $scripts_for_layout;
 ?>
<?php
    $server = $_SERVER['HTTP_HOST'];
    if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
      $uri = 'https://';
    } else {
      $uri = 'http://';
    }
    $uri .= $_SERVER['HTTP_HOST'] . $this->webroot;
    $root = $uri;
?>
<?php echo $javascript->link('jquery.js', true);?>
<script type="text/javascript">
    //definiendo constantes para la aplicación
    var _HTTP_HOST          = '<?php echo $server;?>',
        _WEB_ROOT           = '<?php echo $root;?>';
    $(function(){
//        $('#contenido').attr('height', $(document).attr('height'));
        $('#printBtn').click(function(){
            window.print();
        });
        $('#closeBtn').click(function(){
            window.close();
            window.back();
        });
        $('a#mainReports').click(function(){
            var w = $(document).width();
            var l = w / 2 - 429;
            var child = $(this).attr('href');
            $(child).css('left',l);
            $(child).show();
            return false;
        });
        $(':not([id=mainReports])').click(function(){
            var child = $('#mainReports').attr('href');
            $(child).hide();
            //return false;
        });
    });
</script>
</head>
<body>
    <div id="head">
        <div class="topBar">
            <div class="innerBar">
                <?php echo $html->link('Imprimir', '#', array(
                    'id'=>'printBtn',
                    'class'=>'lnkbutton btnprint ui-corner-all'
                ))?>
                <?php echo $html->link('Otros formatos', '#reportDiv', array(
                    'id'=>'mainReports',
                    'class'=>'lnkbutton btnsenddoc ui-corner-all')); ?>
                <?php
                     if (array_key_exists('HTTPS', $_SERVER) && $_SERVER["HTTPS"] == "on")
                         $url = "https";
                     else $url = 'http';
                     $url .= "://";
                     if ($_SERVER["SERVER_PORT"] != "80")
                         $url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$this->webroot;
                     else
                        $url .= $_SERVER["SERVER_NAME"].$this->webroot;
                     
                     $pageURL = $_SERVER["REQUEST_URI"];
                ?>
                <div id="reportDiv" class="hidden">
                    <ul>
                        <li><?php echo $html->link('Formato de Documento Portable (PDF)', $url.'Reporter/toPdf?page='.htmlentities($pageURL)); ?></li>
                        <li><?php echo $html->link('Microsoft Office Word (DOC)', $url.'Reporter/toDoc?page='.htmlentities($pageURL)); ?></li>
                        <li><?php echo $html->link('Microsoft Office Excel (XLS)', $url.'Reporter/toXls?page='.htmlentities($pageURL)); ?></li>
                        <li><?php echo $html->link('Formato de Texto Enriquecido (RTF)', $url.'Reporter/toRtf?page='.htmlentities($pageURL)); ?></li>
                        <li><?php echo $html->link('Formato de Documento Abierto (ODFD)', $url.'Reporter/toOdfd?page='.htmlentities($pageURL)); ?></li>
                        <li><?php echo $html->link('Formato de Documento Abierto (ODFC)', $url.'Reporter/toOdfc?page='.htmlentities($pageURL)); ?></li>
                        <li><?php echo $html->link('Formato XML', $url.'Reporter/toXml?page='.htmlentities($pageURL)); ?></li>
                    </ul>
                </div>
                <?php echo $form->button('Cerrar', array(
                    'id'=>'closeBtn',
                    'class'=>'btncancel ui-corner-all'
                ))?>
            </div>
        </div>
    </div>
    <div id="contenido">
        <?php echo $content_for_layout; ?>
    </div>
</body>
</html>